package home

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

// HomePage 处理主页的HTTP请求
func HomePage(c *gin.Context) {
	html := `
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>工具集</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
            text-align: center;
        }
        .header {
            text-align: center;
            margin-bottom: 30px;
        }
        .card {
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            padding: 24px;
            margin-bottom: 24px;
        }
        .card-header {
            margin-bottom: 20px;
            padding-bottom: 16px;
            border-bottom: 1px solid #e8e8e8;
        }
        .card-title {
            font-size: 24px;
            font-weight: 600;
            margin: 0;
        }
        .tools-list {
            display: flex;
            flex-direction: column;
            gap: 16px;
            list-style: none;
            padding: 0;
        }
        .tool-item {
            display: flex;
            justify-content: center;
        }
        .btn {
            background: #1890ff;
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            text-decoration: none;
            display: inline-block;
            transition: background 0.3s;
            width: 200px;
            margin: 5px;
        }
        .btn:hover {
            background: #40a9ff;
        }
        .btn-license {
            background: #1890ff;
        }
        .btn-batch-license {
            background: #722ed1;
        }
        .btn-encryption {
            background: #52c41a;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>工具集</h1>
            <p>请选择您要使用的工具</p>
        </div>
        
        <div class="card">
            <div class="card-header">
                <h2 class="card-title">可用工具</h2>
            </div>
            <ul class="tools-list">
                <li class="tool-item">
                    <a href="/license" class="btn btn-license">License 生成器</a>
                </li>
                <li class="tool-item">
                    <a href="/license/batch" class="btn btn-batch-license">批量生成 License</a>
                </li>
                <li class="tool-item">
                    <a href="/encryption" class="btn btn-encryption">JSON 加解密工具</a>
                </li>
            </ul>
        </div>
    </div>
</body>
</html>
`
	c.Data(http.StatusOK, "text/html; charset=utf-8", []byte(html))
}